<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  </head>
  <body>
    <button id="btnGet">GET请求</button>
    <button id="btnPost">POST请求</button>
    <button id="btnDelete">Delete请求</button>
    <script>
      $(() => {
        $("#btnGet").on("click", () => {
          $.ajax({
            type: "GET",
            url: "http://127.0.0.1/api/get",
            data: {
              name: "李刚",
              age: 35,
              money: "10万亿",
            },
          });
        });

        $("#btnPost").on("click", () => {
          $.ajax({
            type: "POST",
            url: "http://127.0.0.1/api/post",
            data: {
              type: "post请求",
              author: "李刚",
              money: "999",
            },
          });
        });
        $("#btnDelete").on("click", () => {
          $.ajax({
            type: "DELETE",
            url: "http://127.0.0.1/api/delete",
            data: {
              type: "delete请求",
            },
          });
        });
      });
    </script>
  </body>
</html>
